﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;
using Thaire.Investment.Domains.Transaction;

namespace Thaire.Investment.Repository
{
    public class RatingHistoryRepo  : BaseRepository <RatingHistory, int>
    {
        public RatingHistoryRepo(ISession session)
            : base(session)
        {
        }


        public List<RatingHistory> GetByFixIncomeSecuritiesHeaderID(int id)
        {
           return new List<RatingHistory>( _session.QueryOver<RatingHistory>()
               .Where(x => x.FinancialInstrumentId == id)
               .OrderBy(x=>x.CreateTs).Asc.List());
        }

        public List<RatingHistory> GetByDepositHeaderID(int id)
        {
            return new List<RatingHistory>(_session.QueryOver<RatingHistory>()
                .Where(x => x.FinancialInstrumentId == id)
                .And(x => x.FinancialInstrumentType == "DEPOSIT")
                .OrderBy(x => x.CreateTs).Asc.List());
        }

       
    }
}
